<template>
  <el-card class="common-card" :class="{ 'card-clickable': clickable }" @click="handleClick">
    <template #header v-if="title || $slots.header">
      <div class="card-header">
        <span class="card-title">{{ title }}</span>
        <div class="card-actions" v-if="$slots.actions">
          <slot name="actions"></slot>
        </div>
      </div>
    </template>
    
    <div class="card-content">
      <slot></slot>
    </div>
    
    <div class="card-footer" v-if="$slots.footer">
      <slot name="footer"></slot>
    </div>
  </el-card>
</template>

<script setup lang="ts">
interface Props {
  title?: string
  clickable?: boolean
}

const props = withDefaults(defineProps<Props>(), {
  title: '',
  clickable: false
})

const emit = defineEmits<{
  (e: 'click'): void
}>()

const handleClick = () => {
  if (props.clickable) {
    emit('click')
  }
}
</script>

<style scoped>
.common-card {
  width: 100%;
  margin-bottom: 20px;
}

.card-clickable {
  cursor: pointer;
  transition: all 0.3s ease;
}

.card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-weight: bold;
  font-size: 16px;
  color: #333;
}

.card-actions {
  display: flex;
  align-items: center;
}

.card-content {
  padding: 10px 0;
}

.card-footer {
  padding-top: 10px;
  border-top: 1px solid #eee;
}
</style>